package com.dg11185.nearshop.activity.user.info;

import com.dg11185.nearshop.net.response.GetUserDetailResponse;

/**
 * 个人资料界面的presenter层，完成相关逻辑处理
 * @author：Daibo    
 * @time：2014-9-12 下午2:45:01
 */
public class UserInfoPresenter {

    private IUserInfoView view;
    private IUserInfoModel model;
    
    public UserInfoPresenter(UserInfoActivity activity, String userId){
        this.view = activity;
        model = new UserInfoModel(this, activity, userId);
    }
    
    public void getUserInfo(){
        view.showLoadingView();
        model.getUserInfo();
    }

    public void onGetInfoSuccess(GetUserDetailResponse result){
        view.showUserInfo(result);
    }
    
    public void onGetInfoFailure(int resultCode){
        view.onLoadingFailure(resultCode);
    }
    
    public void modifyBirthday(String brith){
        view.showSubmitDialog();
        model.submitBrithDay(brith);
    }
    
    public void modifyGender(String gender){
        view.showSubmitDialog();
        model.submitGender(gender);
    }
    
    public void onSubmitSuccess(){
        view.onSubmitSuccess();
    }
    
    public void onSubmitFailure(int statusCode){
        view.onSubmitFailure(statusCode);
    }
}
